const TOKEN_KEY = 'token-geek-mobile'

/**
 *
 * @returns 获取token
 */
export const getToken = () => JSON.parse(window.localStorage.getItem(TOKEN_KEY)) || {}

/**
 *
 * @param {*} token 传入token
 */
export const setToken = (token) => {
  localStorage.setItem(TOKEN_KEY, JSON.stringify(token))
}

/**
 *
 * @returns 移除token
 */
export const removeToken = () => window.localStorage.removeItem(TOKEN_KEY)

/**
 *
 * @returns 判断是否有token
 */
export const hasToken = () => !!getToken().token



